

export const APPLICATION_INIT_SQL = `
CREATE TABLE _g01_application_conversations (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    application_identifier TEXT DEFAULT '',
    identifier TEXT DEFAULT '',
    name TEXT DEFAULT '',
    title TEXT DEFAULT '',
    icon TEXT DEFAULT '',
    is_pinned INTEGER DEFAULT 1,
    inputs TEXT DEFAULT '',
    status TEXT DEFAULT '',
    options TEXT DEFAULT '',
    description TEXT DEFAULT '',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TRIGGER _g01_application_conversations_updated AFTER UPDATE ON _g01_application_conversations 
BEGIN
UPDATE _g01_application_conversations SET updated_at = CURRENT_TIMESTAMP WHERE id = new.id;
END;

CREATE TABLE _g01_application_conversation_messages (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    conversation_identifier TEXT DEFAULT '',
    identifier TEXT DEFAULT '',
    parent_identifier TEXT DEFAULT '',
    name TEXT DEFAULT '',
    title TEXT DEFAULT '',
    icon TEXT DEFAULT '',
    inputs TEXT DEFAULT '',
    query TEXT DEFAULT '',
    answer TEXT DEFAULT '',
    files TEXT DEFAULT '',
    feedback TEXT DEFAULT '',
    retriever_resources TEXT DEFAULT '',
    status TEXT DEFAULT '',
    options TEXT DEFAULT '',
    description TEXT DEFAULT '',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TRIGGER _g01_application_conversation_messages_updated AFTER UPDATE ON _g01_application_conversation_messages 
BEGIN
UPDATE _g01_application_conversation_messages SET updated_at = CURRENT_TIMESTAMP WHERE id = new.id;
END;

`